﻿using System;
using System.Linq;
using System.Linq.Expressions;

namespace nMongo
{
    public partial class MongoRepository<T>
    {
        /// <summary>
        /// Checks if an object exists in the collection, giving a specified condition.
        /// </summary>
        /// <param name="predicate">Expression to evaluate and determines the condition satisfaction.</param>
        public bool Exists(Expression<Func<T, bool>> predicate)
        {
            return CollectionQuery.Any(predicate);
        }
    }
}
